﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Vortex.Drawing {
	/// <summary>
	/// Contains binding between texture and sampler index. It is mapping between texture and Canvas2D samplers
	/// </summary>
	public class TextureIndex {
		private int _index;
		private BaseTexture _texture;

		/// <summary>
		/// Initializes a new instance of the <see cref="TextureIndex"/>.
		/// </summary>
		/// <param name="index">The index of texture sampler to bind.</param>
		/// <param name="texture">The texture to bind.</param>
		public TextureIndex(int index, BaseTexture texture) {
			if (index<0 || index >= CanvasStates.MAX_TEXTURE_COUNT) {
				throw new ArgumentException("Texture index should be integer in range 0.." + CanvasStates.MAX_TEXTURE_COUNT, "index");
			}
			_index = index;
			_texture = texture;
		}

		/// <summary>
		/// Gets the index of sampler.
		/// </summary>
		/// <value>The index of sampler.</value>
		public int Index {
			get { return _index; }
		}

		/// <summary>
		/// Gets the texture of sampler.
		/// </summary>
		/// <value>The texture.</value>
		public BaseTexture Texture {
			get { return _texture; }
		}
	}

}
